<template>
  <div class="flower">
    <h4 class="title">
      送恋人/爱情鲜花
    </h4>
    <div class="items">
      <div
        class="item"
        v-for="(item, index) in items"
        :key="item.id"
        @click="clickItem(item.id, index)"
      >
        <img v-lazy="item.pic" class="img" alt="" />
        <div class="item-info">
          <h5 class="name">{{ item.name }}</h5>
          <p class="desc">
            {{ item.characteristic ? item.characteristic : "暂无描述" }}
          </p>
          <div class="acion">
            <p class="price">￥{{ item.minPrice }}</p>
            <van-icon @click.stop="clickCart(item.id, index)" size="25" class-prefix="icon" name="shop" />
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    items: {
      type: Array,
      required: true
    }
  },
  methods: {
    clickCart (id, index) {
      this.$emit('clickCart', { id, index })
    },
    clickItem (id, index) {
      this.$emit('cliclItem', { id, index })
    }
  }
}
</script>

<style lang="scss" scoped>
.title {
  line-height: 50px;
  text-align: center;
  color: #333;
  font-size: 18px;
  font-weight: 700;
}
.items {
  .item {
    height: 230px;
    margin: 8px 0;
    display: flex;
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    align-items: center;
    .img {
      width: 180px;
      height: 180px;
    }
    .item-info {
      flex: 1;
      height: 100%;
      padding-top: 20px;
      padding-left: 5px;
      .name {
        font-size: 16px;
        font-weight: 600;
        color: #333;
        margin-top: 10px;
        line-height: 20px;
      }
      .desc {
        width: 100%;
        font-size: 12px;
        color: #666;
        margin-top: 20px;
        line-height: 20px;
      }
      .acion {
        display: flex;
        margin-top: 60px;
        padding-right: 10px;
        height: 50px;
        align-items: center;
        justify-content: space-between;
        font-size: 16px;
        color: #ff734c;
        .price {
          font-size: 16px;
          font-weight: 600;
          color: #232628;
        }
      }
    }
  }
}
</style>
